<fieldset>
    <legend>条件搜索</legend>
    <form action="{:request()->url()}" autocomplete="off" class="layui-form layui-form-pane form-search" method="get" onsubmit="return false">
        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">城市对接人</label>
            <label class="layui-input-inline">
                <input class="layui-input" name="uuid_city_name" placeholder="城市对接人" value="{:input('uuid_city_name','')}">
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">锁定车牌</label>
            <label class="layui-input-inline">
                <input class="layui-input" name="plate_number" placeholder="请输入锁定车牌"
                       value="{:input('plate_number')}">
            </label>
        </div>

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">是否解锁</label>
            <div class="layui-input-inline">
                <select class="layui-select" name="is_unlock">
                    <option value=''>-- 全部 --</option>
                    {foreach ['否', '是'] as $k=>$v}
                        {if $k.'' eq input('is_unlock')}
                            <option selected value="{$k}">{$v}</option>
                        {else}
                            <option value="{$k}">{$v}</option>
                        {/if}
                    {/foreach}
                </select>
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>

            <button class="layui-btn layui-btn-primary" data-form-export="{:url('indexExport')}?uuid_city_name={:input('uuid_city_name')}&plate_number={:input('plate_number')}&is_unlock={:input('is_unlock')}"
                    type="button">
                <i class="layui-icon layui-icon-export"></i> 导 出
            </button>
        </div>
    </form>

    <script>form.render()</script>
</fieldset>


<script>
    window.form.render();
    require(['excel'], function (excel) {
        excel.bind(function (data) {
            var items = [];
            items.push(['ID', '城市对接人', '锁定车辆', '锁定时间', '是否解锁', '解锁时间']);
            data.forEach(function (item) {
                items.push([
                    {v: item.id, t: 'n'},
                    item.uuid_city_name,
                    item.plate_number,
                    item.create_at || '',
                    item.is_unlock_text || '',
                    item.unlock_at || '',
                ]);
            });
            return items;
        }, '品质解锁记录');
    });

</script>